namespace BootstrapBlazorApp.Server.LLMs.function;

using Newtonsoft.Json;

public class FunctionInput
{
    [JsonProperty(PropertyName = "type")] 
    public string Type { get; set; } = "function";

    [JsonProperty(PropertyName = "function")]
    public required Function Function { get; set; }
}

public class Function
{
    [JsonProperty(PropertyName = "name")]
    public required string Name { get; set; }

    [JsonProperty(PropertyName = "description")]
    public required string Description { get; set; }

    [JsonProperty(PropertyName = "parameters")]
    public Parameters Parameters { get; set; } = new();

    [JsonProperty(PropertyName = "required")]
    public string[]? Required { get; set; }
}

public class Parameters
{
    [JsonProperty(PropertyName = "type")] 
    public string? Type { get; set; }

    [JsonProperty(PropertyName = "properties")]
    public Dictionary<string, ArgDescription>? Properties { get; set; }

    public Parameters() { }

    public Parameters(Dictionary<string, ArgDescription> properties)
    {
        Type = "object";
        Properties = properties;
    }

}

public class ArgDescription
{
    [JsonProperty(PropertyName = "type")] 
    public required string Type { get; set; }
    [JsonProperty(PropertyName = "description")]
    public required string Description { get; set; }
}